﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ctr='clr-namespace:NczControlLibrary.Controls'>
    <ctr:IndicatorVisibility x:Key='iv'/>
    <Style TargetType='ctr:IndicatorButton'>
        <Setter Property='Template'>
            <Setter.Value>
                <ControlTemplate TargetType='ctr:IndicatorButton'>
                    <Border Width='{TemplateBinding Width}' Height='{TemplateBinding Height}' BorderBrush='{TemplateBinding BorderBrush}' BorderThickness='{TemplateBinding BorderThickness}' CornerRadius='{TemplateBinding CornerRadius}' x:Name='root'>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name='vsg1'>
                                <VisualState x:Name='down'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.1' To='.96' Storyboard.TargetName='root' Storyboard.TargetProperty='(Border.RenderTransform).(ScaleTransform.ScaleX)'/>
                                        <DoubleAnimation Duration='0:0:.1' To='.96' Storyboard.TargetName='root' Storyboard.TargetProperty='(Border.RenderTransform).(ScaleTransform.ScaleY)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='up'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.1' To='1' Storyboard.TargetName='root' Storyboard.TargetProperty='(Border.RenderTransform).(ScaleTransform.ScaleX)'/>
                                        <DoubleAnimation Duration='0:0:.1' To='1' Storyboard.TargetName='root' Storyboard.TargetProperty='(Border.RenderTransform).(ScaleTransform.ScaleY)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='normal'/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <StackPanel Background='{TemplateBinding Background}' Margin='{TemplateBinding Padding}' HorizontalAlignment='Stretch' VerticalAlignment='Stretch'>
                            <TextBlock Text='{TemplateBinding Text}' FontSize='{TemplateBinding FontSize}' FontWeight='{TemplateBinding FontWeight}' Foreground='{TemplateBinding Foreground}' VerticalAlignment='Bottom' HorizontalAlignment='Stretch'/>
                            <Rectangle Opacity='0' Height='{TemplateBinding Interval}' VerticalAlignment='Stretch'/>
                            <Border Height='6' HorizontalAlignment='Center' VerticalAlignment='Stretch'>
                                <Path x:Name='fPath' Data='m0,0l10,0 -5,4 -5,-4z' Fill='{TemplateBinding PathFill}' Stroke='{TemplateBinding Stroke}' StrokeThickness='{TemplateBinding StrokeThickness}' Visibility='{Binding Path=IsSelected,RelativeSource={RelativeSource Mode=TemplatedParent},Converter={StaticResource iv}}'/>
                            </Border>
                        </StackPanel>
                        <Border.RenderTransform>
                            <ScaleTransform CenterX='0' CenterY='0'/>
                        </Border.RenderTransform>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
